package com.skcc.cip.ngms.converter;

import org.apache.camel.Exchange;

import com.skcc.cip.component.sharepoint.dto._2007.board.BoardContentRequestDto;
import com.skcc.cip.component.sharepoint.dto._2007.board.BoardListRequestDto;
import com.skcc.cip.component.sharepoint.dto._2007.board.CommentUpdateRequestDto;
import com.skcc.cip.ngms.dto.request.jaxb.bulletin.contents.BulletinContentsRequest;
import com.skcc.cip.ngms.dto.request.jaxb.bulletin.list.BulletinListRequest;
import com.skcc.cip.ngms.dto.request.jaxb.bulletin.replyreg.BulletinReplyRegRequest;

public class BulletinTransform {
    final static private String domain           = "skcc";
    final static private String host             = "hisk.skcc.com";
    // final static private String serverUrl =
    // "http://hisk.skcc.com/workplace/RD10080/_vti_bin/Lists.asmx";
    final static private String freeBoard        = "{988B8622-526E-43A5-BBB4-FC59CC9B2F8D}";
    final static private String noticeBoard      = "{CA88C85E-2A84-4417-94C7-86B611EB11CA}";//"{EBC23AAA-36E0-42C0-A804-5E33E7C5BADD}";
    final static private String marketBoard      = "{A5DE9F04-5789-4AFC-AE74-37B9B1D6839B}";
    final static private String noticeDocBoard   = "{48418A1D-B72A-4087-9F09-E7E543545236}";
    final static private String celebrationBoard = "{DC1F88FB-FD15-4728-A0EC-F5B7B824C14F}";
    final static private String condolenceBoard  = "{DC1F88FB-FD15-4728-A0EC-F5B7B824C14F}";

    /**
     * List REQUEST 값을 setting 해준다.
     * 
     * @param boardName
     * @param dto
     * @return BoardListRequestDto
     */
    public BoardListRequestDto setListRequest(Exchange exchange, BulletinListRequest dto) {
    	exchange.getIn().setHeader("authHost",host);
    	exchange.getIn().setHeader("authDomain",domain);
    					
        BoardListRequestDto returnDto = new BoardListRequestDto();
        returnDto.setBoardName(marketBoard);
        returnDto.setFieldList("ID;Title;SKCCHPW_Author;");
        returnDto.setPage(dto.getPage());
        returnDto.setOperationName("BOARD_LIST");
        returnDto.setAuthDomain(domain);
        returnDto.setAuthHost(host);
        
        return returnDto;
    }
    
    public BoardContentRequestDto setContentRequest(Exchange exchange, BulletinContentsRequest dto) {
    	exchange.getIn().setHeader("authHost",host);
    	exchange.getIn().setHeader("authDomain",domain);
    	
        BoardContentRequestDto returnDto = new BoardContentRequestDto();
        returnDto.setBoardName(marketBoard);
        returnDto.setFieldList("ID;Title;SKCCHPW_Author;Created;SKCCHPW_ActiveDesigner;Attachments;SKCCHPW_NameComment;");
        returnDto.setBoadrItemId(dto.getBulletinKey());
        returnDto.setTextBodyTypefieldList("SKCCHPW_ActiveDesigner;");
        returnDto.setCommentFieldName("SKCCHPW_NameComment");
        returnDto.setOperationName("BOARD_CONTENT");
        returnDto.setAuthDomain(domain);
        returnDto.setAuthHost(host);
        return returnDto;
    }
    
    public CommentUpdateRequestDto setReplyRegRequest(Exchange exchange, BulletinReplyRegRequest dto) {
    	exchange.getIn().setHeader("authHost",host);
    	exchange.getIn().setHeader("authDomain",domain);
    	
        CommentUpdateRequestDto returnDto = new CommentUpdateRequestDto();
        returnDto.setBoardName(marketBoard);
        returnDto.setBoadrItemId(dto.getBulletinKey());
        returnDto.setParentKey(dto.getParentKey());
        returnDto.setCommentFieldName("SKCCHPW_NameComment");
        returnDto.setOperationName("COMMENT_UPDATE");
        returnDto.setAuthDomain(domain);
        returnDto.setAuthHost(host);
        returnDto.setActionType("CREATE");
        
        return returnDto;
    }
    
//    public  CommentUpdateRequestDto setReplyRegRequest(Exchange exchange, BulletinReplyRequest dto) {
//    	exchange.getIn().setHeader("authHost",host);
//    	exchange.getIn().setHeader("authDomain",domain);
//    	
//        CommentUpdateRequestDto returnDto = new CommentUpdateRequestDto();
//        returnDto.setBoardName(marketBoard);
//        returnDto.setBoadrItemId(dto.getBulletinKey());
//        returnDto.setParentKey(dto.getParentKey());
//        returnDto.setCommentFieldName("SKCCHPW_NameComment");
//        returnDto.setOperationName("COMMENT_UPDATE");
//        returnDto.setAuthDomain(domain);
//        returnDto.setAuthHost(host);
//        returnDto.setActionType("CREATE");
//        return returnDto;
//    }
    
 	
}
